package com.hippo.core.controller;

import com.alibaba.fastjson.JSONObject;
import com.hippo.core.service.RuleConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: hippo
 */
@RestController
@RequestMapping("/ruleConfig")
public class RuleConfigController {

    @Autowired
    private RuleConfigService ruleConfigService;

    @GetMapping("/faker")
    public JSONObject getFakerList() {
        return ruleConfigService.getFakerList();
    }

    @GetMapping("/getParams")
    public JSONObject getParams(@RequestParam String value, @RequestParam String child_value) {
        return ruleConfigService.getParams(value, child_value);
    }


    @PostMapping("/reList")
    public JSONObject reList(@RequestBody JSONObject data) {
        return ruleConfigService.reList(data);
    }

    @PostMapping("/re")
    public JSONObject createRe(@RequestBody JSONObject data) {
        return ruleConfigService.createRe(data);
    }

    @DeleteMapping("/re/{id}")
    public JSONObject deleteRe(@PathVariable String id) {
        return ruleConfigService.deleteRe(id);
    }

    @PutMapping("/re")
    public JSONObject updateRe(@RequestBody JSONObject data) {
        return ruleConfigService.updateRe(data);
    }

}
